import {
  Complex
} from '../api/complex'

class BookModel extends Complex {
  getHotList () {
    return this.$axios({
      url: 'book/hot_list'
    })
  }

  search (start, q) {
    return this.$axios({
      url: 'book/search?summary=1',
      data: {
        q,
        start
      }
    })
  }

  getDetail (bid) {
    return this.$axios({
      url: `book/${bid}/detail`
    })
  }

  getLikeStatus (bid) {
    return this.$axios({
      url: `book/${bid}/favor`
    })
  }

  getComments (bid) {
    return this.$axios({
      url: `book/${bid}/short_comment`
    })
  }

  postComment (bid, comment) {
    return this.$axios({
      url: 'book/add/short_comment',
      method: 'POST',
      data: {
        book_id: bid,
        content: comment
      }
    })
  }
}

export {BookModel}
